<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ include file="/common/backcommon.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Breaking Fast</title>
		<script type="text/javascript">
			$(function() {
				//验证信息
				$.formValidator.initConfig({
					formID: "addForm",
					debug:false,
					onError: function(msg, obj, errorlist){
					}
				});
				
				$("#combochname").formValidator({onShow:"请输入中文套餐名", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, max:25, onError:"中文套餐名为0-25个字符"}).regexValidator({regExp: "Illegal", dataType:"enum", onError:"中文套餐名中包含非法字符"});
				$("#comboenname").formValidator({onShow:"请输入英文套餐名", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, max:25, onError:"英文套餐名为0-25个字符"}).regexValidator({regExp: "enname", dataType:"enum", onError:"英文套餐名中包含非法字符"});
				$("#price").formValidator({onShow: "请输入数字", onCorrect: "恭喜你,你输对了"}).inputValidator({min:0.1, max:9999, onError:"单价在0-9999之间"}).inputValidator({min:0, max:9999, type:"value", onErrorMin:"你输入的值必须大于等于0", onError:"单价必须在0-9999之间，请确认"});
				$("#hot").formValidator({onShow: "请输入数字", onCorrect: "恭喜你,你输对了"}).inputValidator({min:0.1, max:9999, onError:"热量在0-9999之间"}).inputValidator({min:0, max:9999, type:"value", onErrorMin:"你输入的值必须大于等于0", onError:"热量必须在0-9999之间，请确认"}).regexValidator({regExp: "intege1", dataType:"enum", onError:"热量必须整数"});;
				$("#comboImage").formValidator({triggerEvent:"change",onShow:"请上传套餐图片", onFocus:"图片格式可以为jpg|bmp|gif|jpeg|png", onCorrect:"恭喜您，图片可用"}).regexValidator({regExp:"picture",dataType:"enum",onError:"图片格式不正确"}).defaultPassed();
				$("#nutritioninfo").formValidator({empty:true, onShow:"请输入营养信息", onCorrect:"恭喜你,你输对了"}).inputValidator({max:500, onError:"你输入的营养信息太长"}).regexValidator({regExp: "Illegal", dataType:"enum", onError:"营养信息中包含非法字符"});
				$("#dishNames").formValidator({onShow:"请选择菜品"}).inputValidator({min:1, onError:"请选择菜品"});
				
				$("#resetBtn").click(function(){
					$("#dishIds").val($("#oldDishIds").val());
				});
				
				$("#dishNames").click(function(){
					var dishIds = $("#dishIds").val();
					var dishNames = $("#dishNames").val();
					var selectDishValue = window.showModalDialog('${base}/background/combo/combodishselect.jsp',dishIds + '_' + dishNames,'dialogWidth:1000px;dialogHeight:550px;help:no;resizable:no');
					if(null != selectDishValue && 0 != selectDishValue.length){
						var dishInfoArr = selectDishValue.split("_");
						$("#dishIds").val(dishInfoArr[0]);
						$("#dishNames").val(dishInfoArr[1]);
					}
				});
			});
		</script>
	</head>
	<body>
		<div class="cms_right">
		  	<div class="cms_title">
		    	<span>套餐管理：${combo.comboid == null ? "新增" : "修改"} </span>
		    </div>
		    <div class="cms_search">
		    	<form:form id="addForm" commandName="combo" action="${base}/backComboCtl/operate" method="post" enctype="multipart/form-data">
					<table width="1000" border="0" class="search_bd">
			          	<tr>
				            <td class="yh_name">中文名称：</td>
				            <td class="yh_bd"><input type="text" id="combochname" name="combochname" maxlength="25" class="cms_text02" value="${combo.combochname}" /></td>
				            <td class="tishi"><div id="combochnameTip" ></div></td>
				            <td class="yh_name">英文名称：</td>
				            <td class="yh_bd"><input type="text" id="comboenname" name="comboenname" maxlength="25" class="cms_text02" value="${combo.comboenname}" /></td>
				            <td class="tishi"><div id="comboennameTip"></div></td>
			          	</tr>
			          	<tr>
				            <td class="yh_name">单价：</td>
				            <td class="yh_bd"><input type="text" id="price" name="price" class="cms_text02" value="${combo.price}" /></td>
				            <td class="tishi"><div id="priceTip"></div></td>
				            <td class="yh_name">热量(千卡)：</td>
				            <td class="yh_bd"><input type="text" id="hot" name="hot" class="cms_text02" value="${combo.hot}" /></td>
				            <td class="tishi"><div id="hotTip"></div></td>
			          	</tr>
			          	<tr>
				            <td class="yh_name">菜品：</td>
				            <td class="yh_bd" colspan="4">
				            	<input type="text" id="dishNames" class="cms_text02" style="width:650px" readonly="readonly" value="${dishNames}" />
				            	<input type="hidden" name="dishIds" id="dishIds" class="cms_text02" value="${dishIds}" />
				            	<input type="hidden" id="oldDishIds" class="cms_text02" value="${dishIds}" />
			            	</td>
				            <td class="tishi"><div id="dishNamesTip"></div></td>
			          	</tr>
			          	<tr>
				            <td class="yh_name">图片：</td>
				            <td class="yh_bd" colspan="4"><input type="file" id="comboImage" name="comboImage"  maxlength="50" style="width: 80%" /></td>
				            <td class="tishi"><div id="comboImageTip"></div></td>
			          	</tr>
			          	<tr>
				            <td class="yh_name">营养信息：</td>
				            <td colspan="4">
				            	<textarea id="nutritioninfo" name="nutritioninfo" rows="3" cols="100" style="border:1px solid #a0a0a0;resize:none">${combo.nutritioninfo}</textarea>
				            </td>
				            <td class="tishi"><div id="remarkTip"></div><br></td>
			          	</tr>
			          	<tr>
				            <td>&nbsp;</td>
				            <td align="right"><input type="reset" id="resetBtn" class="search_btn" value="重置" /></td>
				            <td align="center"><input type="button" class="search_btn" onclick="location.href='${base}/background/combo/combolist.jsp'" value="返回" /></td>
				            <td><input type="submit" class="search_btn" value="确定" /></td>
				            <td>&nbsp;</td>
				            <td>
				            	<input type="hidden" name="photo" value="${combo.photo}" />
				            	<input type="hidden" name="status" value="${combo.status}" />
				            	<input type="hidden" name="comboid" value="${combo.comboid}" />
				            </td>
						</tr>
					</table>
				</form:form>
			</div>
		</div>
	</body>
</html>
	